﻿@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
    Layout = null;
}
@* 仓库管理/仓库列表 *@
<link href="~/lib/layui/css/layui.css" rel="stylesheet" />
<script src="~/lib/layui/layui.js"></script>
<script src="~/js/js.cookie.js"></script>
<script src="~/js/moment.js"></script>
<script src="~/lib/jquery/dist/jquery.js"></script>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Demo</title>
    <!-- 请勿在项目正式环境中引用该 layui.css 地址 -->
    @* <link href="//unpkg.com/layui@2.9.20/dist/css/layui.css" rel="stylesheet"> *@
</head>
<body class="layui-padding-3">
    <h3>仓库管理/仓库列表</h3>
    <form class="layui-form layui-row layui-col-space16" lay-filter="ID-table-demo-search">
        <div class="layui-col-md4">
            <div class="layui-input-wrap">
                <div class="layui-input-prefix"></div>
                <label class="layui-form-label">仓库名称</label>
                <input type="text" placeholder="请输入" name="WareName" id="WareName" class="layui-input" style="width:200px" />
            </div>
        </div>
        <div class="layui-col-md4">
            <div class="layui-input-wrap">
                <div class="layui-input-prefix"></div>
                <div class="layui-form-item">
                    <label class="layui-form-label">状态</label>
                    <div class="layui-input-block" style="width: 200px">
                        <select name="status">
                            <option name="status" value=-1>选择状态</option>
                            <option name="status" value=1>有效</option>
                            <option name="status" value=0>无效</option>
                        </select>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-btn-container layui-col-xs12">
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            <button class="layui-btn" lay-submit lay-filter="search">
                查询
            </button>
            <a class="layui-btn" onclick="location.href='/Warehouse/WarehouseAdd'">新增</a>
        </div>

    </form>
    <table class="layui-hide" id="ID-table-demo-search"></table>

    <!-- 请勿在项目正式环境中引用该 layui.js 地址 -->
    @* <script src="//unpkg.com/layui@2.9.20/dist/layui.js"></script> *@
    <script>

        layui.use('table',function () {
            var form = layui.form;
            var layer = layui.layer;
            var laydate = layui.laydate;
            var util = layui.util;
            var table = layui.table;

            var formData = {
                WareName: '',
                status: -1
            };
            Seach();

            // 提交事件
            form.on('submit(search)', function (data) {
                var field = data.field; // 获取表单字段值
                // 显示填写结果，仅作演示用
                formData.WareName = field.WareName;
                formData.status = field.status;
                Seach();
                return false; // 阻止默认 form 跳转
            });


            // 搜索提交
            function Seach() {
                console.log(formData); 
                var WareNum = '@ViewBag.RBACWrite' + "/api/Warehouse/WareHouseList?Name=" + formData.WareName + '&Status=' + formData.status;
                $.ajax({
                    url: WareNum,
                    type: 'get',
                    dataType: "json",
                    contentType: "application/json",
                    success: res => {
                        table.render({
                            elem: '#ID-table-demo-search',
                            cols: [[
                                { type: 'checkbox', title: '复选框', fixed: true }, // 单选框
                                { field: 'warehousNumBer', title: '仓库编码', width: 100, fixed: true },
                                { field: 'warehouseName', title: '仓库名称', width: 100 },
                                { field: 'warehouseAddr', title: '仓库地址', width: 100 },
                                { field: 'warehouseRemark', title: '备注', width: 100 },
                                { field: 'warehouseCreateTime', title: '创建时间', width: 100 },
                                { field: 'warehouseCreateName', title: '创建人', width: 100 },
                                { field: 'warehouseState', title: '状态', width: 100 },
                                { fixed: 'right', title: '操作', width: 134, minWidth: 125, templet: '#toolDemo' }
                            ]],

                            data: res.data,
                            page: true,
                            limits: [2, 3, 4],
                            height: 310
                        });
                        return;

                    }
                });
            };
        });


    </script>
    <script type="text/html" id="toolDemo">
        <div class="layui-clear-space">
          <a onclick="" style="color:cornflowerblue">编辑</a>
          <br />
          <a onclick="" style="color:cornflowerblue">查看</a>
          <br />
          <a onclick="" style="color:red">删除</a>
        </div>
    </script>

</body>
</html>


   
  